package com.yand.controller.business.order;


import com.github.pagehelper.PageInfo;
import com.yand.api.entity.business.order.THfReorder;
import com.yand.api.service.business.order.OrderSubService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 *  订单控制器类
 */
@Api(tags = "订单控制器类")
@RestController
@RequestMapping("orderSub")
public class OrderSubController {

    @Autowired
    private OrderSubService orderSubService;


    @ApiOperation("跳转续费订单列表页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordersub", value = "续费订单列表", required = true)
    })
    @GetMapping("/list")
    public ModelAndView list(THfReorder subOrder, Model model){
        ModelAndView modelAndView = new  ModelAndView();

        modelAndView.setViewName("business/order/suborder-list");
        PageInfo<THfReorder> orderSubPageInfo = orderSubService.queryAllSubOrderList(subOrder);
        model.addAttribute("pageInfo",orderSubPageInfo);

        model.addAttribute("subOrder",subOrder);

        return modelAndView;
    }


}
